package com.example.demo1.service.impl;

import com.example.demo1.mapper.UserMapper;
import com.example.demo1.model.User;
import com.example.demo1.model.UserVo;
import com.example.demo1.service.UserService;
import com.example.demo1.util.Common;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jyangzi5
 * @version 1.0
 * @description: TODO
 * @date 2021/4/19 11:22
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public int saveUser(User user) {
        user.setId(Common.workerId());
        return userMapper.saveUser(user);
    }

    @Override
    public void deleteUser(String[] ids) {
        userMapper.deleteUser(ids);
    }

    @Override
    public void modifyUser(User user) {
       userMapper.modifyUser(user);
    }

    @Override
    public List<User> getUserList(UserVo user) {
        return userMapper.getUserList(user);
    }

    @Override
    public int getUserCount(UserVo user) {
        return userMapper.getUserCount(user);
    }

    @Override
    public User getUserById(Long id) {
        return userMapper.getUserById(id);
    }
}
